package com.xahj.bd2104.spark.core

import org.apache.spark.Partitioner

/**
 * Created with IntelliJ IDEA.
 * Author: Amos
 * E-mail: amos@amoscloud.com
 * Date: 2021/9/14
 * Time: 11:13
 * Description: 
 */
object Partitioners {

}


class ModPartitioner(n: Int) extends Partitioner {
  override def numPartitions: Int = n

  override def getPartition(key: Any): Int = {
    key.asInstanceOf[Int] % n
  }
}
